//
// Created by xili on 2024/8/30 20:26.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    unordered_map<int, int> dp;

    int minDays(int n) {
        if (n <= 1) {
            return n;
        }
        if (dp.count(n)) {
            return dp[n];
        }
        dp[n] = min(n % 2 + 1 + minDays(n / 2), n % 3 + 1 + minDays(n / 3));
        return dp[n];
    }
};